package com.tongji.diy.view.filter
{
	import flare.core.Texture3D;
	import flare.materials.filters.TextureFilter;
	
	import flash.display.BitmapData;
	import flash.display.BlendMode;
	import flash.filters.GlowFilter;
	import flash.geom.Point;
	import flash.geom.Rectangle;

	/**
	 * 
	 * @author Sun
	 * 
	 */
	
	public class SelectFilter
	{
		static private var decoFilter:TextureFilter;
		static private var count:uint = 0;
		
		public function SelectFilter()
		{
			trace("Should Get SelectFilter by static function getInst()")
		}
		
		static public function getInst():TextureFilter
		{
			if(count)
				return decoFilter;
			var decorator:BitmapData = new BitmapData(50,50,true);
			decorator.applyFilter(decorator,new Rectangle(0,0,decorator.width,decorator.height),new Point(0,0),new GlowFilter(0x00FF00,1,20,20,2,1,true));
			var pattern1:Texture3D = new Texture3D(decorator);
			//pattern1.upload(scene);
			decoFilter = new TextureFilter(pattern1,1);
			decoFilter.blendMode = BlendMode.MULTIPLY;
			++count;
			return decoFilter;
		}
	}
}